<template>
    <div>
        <h2>父组件</h2>
        <div>{{pMsg}}</div>
        <button @click="getChildMsg">获取子组件中的信息</button>
        <div>{{cMsg}}</div>       
        <hr>
        <son></son>
        <hr>
        <dauther></dauther>

    </div>
</template>

<script>
import Dauther from './Dauther.vue';
import Son from './Son.vue'
export default {
    components:{
        Son,
        Dauther
    },
    data(){
        return{
            pMsg:'爸爸的信息',
            cMsg:''
        }
    },
    methods:{
        getChildMsg(){
           this.cMsg=this.$children[1].dMsg
        }
    }
}
</script>

<style>

</style>